#include<stdio.h>
#include<string.h>

int main()
{
	int sign,key=0,key1=0,key2=0,key3=0,key4=0,score=0;
	char c,n[51]={'\0'};
	gets(n);
	int len=strlen(n);
	if(len>0) score++;
	if(len>8) score++;
	for(sign=0;sign<len;sign++)
	{
		c=n[sign];
		if('0'<=c&&c<='9')
		{
			if(key1==0)
			{
				key++;
				key1=1;
			}
		}
		else if('a'<=c&&c<='z')
		{
			if(key2==0)
			{
				key++;
				key2=1;
			}
		}
		else if('A'<=c&&c<='Z')
		{
			if(key3==0)
			{
				key++;
				key3=1;
			}
		}
		else if(key4==0)
		{
			key++;
			key4=1;
		}
	}
	if(key>1) score+=key-1;
	printf("%d",score);
	return 0;
}
